package com.decapre.zufangwang.controller;

import com.decapre.zufangwang.entity.District;
import com.decapre.zufangwang.service.DistrictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/districts")
@Api(tags = "Districts")
public class DistrictHandler {
    private DistrictService districtService;

    @Autowired
    public DistrictHandler(DistrictService districtService){
        this.districtService = districtService;
    }

    @GetMapping()
    @ApiOperation("getAllDistricts")
    public List<District> getAllDistricts(){
        return districtService.getAllDistrict();
    }

}
